This course takes advantage of functional programming techniques in the design of domain-specific languages. In particular, it shows how to exploit the tagless-final style in the specification of the syntax, type system and semantics of embedded DSLs. The workshop will illustrate the different concerns in the design of embedded DSLs with the embedding of the jq language in Scala, including different semantics based on standard streams and the fs2 library. We will also pay particular attention to some of the new features of Scala 3, like match types, enums, extension methods, etc.
At the end of the course you should be able to:
Laptop is required.
The workshop is structured into four major modules. Each module will cover a partial implementation of the jq embedding in Scala.
Module 1. Ad-hoc embedding
A jq embedding specially tailored to the fs2 streaming library
Module 2. Domain abstraction
Abstracting away the semantic domain, using type-classes
Module 3. Dynamic errors
Adding dynamic typing to the embedding
Module 4. Static typing
Adding static typing to the embedding using Scala 3match types.
This is an intermediate level course. In particular, it assumes familiarity with Scala and basic functional programming techniques: algebraic data types, higher-order functions and type classes.
50% of the proceeds of this workshop will be donated to the NGO MSF (Médicos sin Fronteras).